﻿<UserControl x:Class="Citrix.XaAdminMobile.ViewTablet.SessionDetailsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:res="clr-namespace:Citrix.XaAdminMobile.Resources"
             xmlns:prop="clr-namespace:Citrix.XaAdminMobile.Properties"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
  <UserControl.Resources>
    <DataTemplate x:Key="SessionItem">
      <!-- Note we apply the top/bottom margin on the value text instead. -->
      <Grid Margin="5,0">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="70"/>
          <ColumnDefinition Width="5"/>
          <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <TextBlock Text="{Binding Item1}" Foreground="Gray" FontSize="12"
                   VerticalAlignment="Center" TextWrapping="Wrap"/>

        <!-- The value. We apply the top/bottom margin on the value text to give our items a
        consistent height, since it is always single line (where the left column text can be
        multi line). -->
        <TextBlock Grid.Column="2" Text="{Binding Item2}" FontSize="18" VerticalAlignment="Center"
                   Margin="0,12"/>

      </Grid>
    </DataTemplate>
  </UserControl.Resources>

  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="*"/>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>

    <!-- Top toolbar -->
    <Border Style="{DynamicResource ToolbarBorderStyle}"/>

    <!-- Session details -->
    <ListBox Grid.Row="1" ItemsSource="{Binding SessionDetails}"
             ItemTemplate="{StaticResource SessionItem}"
             Style="{DynamicResource CleanListboxStyle}"
             ScrollViewer.HorizontalScrollBarVisibility="Disabled"
             ItemContainerStyle="{DynamicResource NoSelectionListBoxItem}"/>

    <!-- Loading status -->
    <res:LoadingStatus Grid.Row="2" DataContext="{Binding LoadingStatus}"/>

    <!-- Bottom toolbar -->
    <Border Grid.Row="3" Style="{DynamicResource ToolbarBorderStyle}">
      <Grid>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*"/>
          <ColumnDefinition Width="*"/>
          <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <!-- Refresh -->
        <Button Grid.Column="0" Style="{DynamicResource PlainButtonStyle}"
                Content="{x:Static prop:Resources.RefreshSessionsLabel}" Command="{Binding RefreshCommand}"/>

        <!-- Reset -->
        <Button
          Grid.Column="1" Style="{DynamicResource PlainButtonStyle}" Content="{x:Static prop:Resources.ResetSessionLabel}"
          Command="{Binding ResetCommand}" Background="{DynamicResource ResetBackground}"/>

      </Grid>
    </Border>
  </Grid>
</UserControl>
